package vista;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

@ManagedBean
@SessionScoped
public class AccessBean {
//--------variables(propiedades)
private String name;
private String password;
//---------constructores
    public AccessBean() {
    }
//----------metodos get y set
      public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
//-------- Acciones -------------------
    public String validarLogin(){
        if(name.equals("amalia")&&password.equals("12345")){
        FacesContext context = FacesContext.getCurrentInstance();
        context.getExternalContext().getSessionMap().put("Usuario_Logueado", name);
        
        return "MenuPrincipal";
        }else{
        return "pagina2";
        }
    }
}